@page
@using EasyAbp.EShop.Plugins.Booking.Permissions
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset
@using EasyAbp.EShop.Plugins.Booking.Localization
@using EasyAbp.EShop.Plugins.Booking.Web.Menus
@model IndexModel
@inject IPageLayout PageLayout
@inject IHtmlLocalizer<BookingResource> L
@inject IAuthorizationService Authorization
@{
    PageLayout.Content.Title = L["ProductAsset"].Value;
    PageLayout.Content.BreadCrumb.Add(L["Menu:ProductAsset"].Value);
    PageLayout.Content.MenuItemName = BookingMenus.ProductAsset;
}

@section scripts
{
    <abp-script src="/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/index.js" />
}
@section styles
{
    <abp-style src="/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/index.css"/>
}

<script>
    let storeId = '@Model.Filter.StoreId';
</script>

@if (Model.Filter.StoreId == null)
{
    <abp-dynamic-form abp-model="Filter" data-ajaxForm="true" asp-page="Index">
        <abp-card>
            <abp-card-header>
                <abp-row>
                    <abp-column size-md="_6">
                        <abp-card-title>@L["ProductAsset"]</abp-card-title>
                    </abp-column>
                </abp-row>
            </abp-card-header>
            <abp-card-body>
                <abp-form-content></abp-form-content>
            </abp-card-body>
            <abp-modal-footer>
                <abp-button id="enter-button" button-type="Primary" text="Enter"/>
            </abp-modal-footer>
        </abp-card>
    </abp-dynamic-form>
}
else
{
    <abp-card>
        <abp-card-header>
            <abp-row>
                <abp-column size-md="_6">
                    <abp-card-title>@L["ProductAsset"]</abp-card-title>
                </abp-column>
                <abp-column size-md="_6" class="text-end">
                    @if (await Authorization.IsGrantedAsync(BookingPermissions.ProductAsset.Create))
                    {
                        <abp-button id="NewProductAssetButton"
                                    text="@L["CreateProductAsset"].Value"
                                    icon="plus"
                                    button-type="Primary"/>
                    }
                </abp-column>
            </abp-row>
        </abp-card-header>
        <abp-card-body>
            <abp-table striped-rows="true" id="ProductAssetTable" class="nowrap"/>
        </abp-card-body>
    </abp-card>
}